Presentación De Powerpoint

Presentación De Powerpoint

Software architecture Universidad of Oviedo Software architecture of Oviedo of Lab. 05 Building automation University , Maven, Gradle, npm, grunt,… Science Dependency management Jose Emilio Labra Gayo Computer Hugo Lebredo of of 2019-20 Pablo González School Irene Cid Software architecture Software builders • Tasks ▫ Compilation From source code to binary code ▫ Packaging of Oviedo of Dependency management and integration Also called linking University , ▫ Test execution Science ▫ Deployment Computer ▫ Documentation creation / release notes of of School Software architecture Building automation • Automatize building tasks • Objectives: ▫ Avoid errors (minimize “bad buildings") ▫ Eliminate redundant and repetive tasks of Oviedo of ▫ Manage complexity University , ▫ Improve the product quality ▫ Store a building and release history Science ▫ Continuous integration Computer of of ▫ Save time and money School Software architecture Automation tools • Makefile (C) • Ant (Java) • Maven (Java) • Npm (Node.js) of Oviedo of • SBT (Scala, JVM languages) University , • Gradle (Groovy, JVM languages) Science • rake (Ruby) • etc. Computer of of School Software architecture Maven Building automation tool • Describe how to build the software • Describe software dependencies Principle: Convention over configuration of Oviedo of • Maven provides a default behaviour for the University , project Science Computer of of School Software architecture Maven Building phases: clean, compile, build, test, package, install, deploy Module identification 3 coordinates: Group, Artifact, Version of Oviedo of Dependencies between modules (Project Object Model) University Configuration: XML file , pom.xml Science Computer of of School Software architecture Maven Artifacts storages Store different types of artifact JAR, EAR, WAR, ZIP files, plugins, etc. All the interactions are done through the repository of Oviedo of Without relative paths Share models between development teams University , Science Computer of of School Software architecture Maven POM file (pom.xml) XML syntax Describe a project Name and version of Oviedo of Artifact type (jar, pom, ...) Source code localization University , Dependencies Science Plugins Computer Profiles of of Alternative building configurations School Software architecture Maven Project identification GAV (Group, Artifact, version) Group: Group identifier Artifact: Project name of Oviedo of Version: Formato {Bigger}.{Smaller}.{Development} "-SNAPSHOT“ can be added (during development) University , <?xml version="1.0" encoding="UTF-8"?> Science <project> <modelVersion>4.0.0</modelVersion> <groupId>es.uniovi.asw</groupId> Computer <artifactId>Entrecine8</artifactId> of of <version>1.0</version> </project> School Software architecture Maven Directory structure Maven uses a conventional structure src/main src/main/java of Oviedo of src/main/webapp src/main/resources University , src/test/ Science src/test/java Computer src/test/resources of of . School Software architecture Maven Development cycle generate-sources/generate-resources compile test of Oviedo of package Invocation: mvn clean University integration-test mvn compile , install mvn clean compile Science mvn compile install deploy ... Computer of of clean School Software architecture Maven Automatically managing of dependencies Identification through GAV Environment compile <project> ... of Oviedo of test <dependencies> <dependency> provide <groupId>javax.servlet</groupId> University , <artifactId>servlet-api</artifactId> Type <version>2.5</version> Science <scope>provided</scope> jar, pom, war,... </dependency> . Computer </dependencies> of of </project> School Software architecture Maven Automatically managing of dependencies Dependencies are downloaded Stored in a local repository Intermediate repositories can be created (proxies) of Oviedo of Example: common artifacts for a company University Transitivity , B depends of C Science A depends of B -> C is also downloaded Computer of of School Software architecture Maven Multiple modules Big projects can be divided Each Project creates an artifact They have their own pom.xml file of Oviedo of The parent projects groups all of them University , <project> ... Science <packaging>pom</packaging> <modules> <module>extract</module> Computer <module>game</module> of of </modules> </project> School Software architecture Maven Other phases and plugins archetype:generate – Generates the archetype of the project eclipse:eclipse – Generate eclipse project site – Generate website of the project site:run - Generate website and runs server of Oviedo of javadoc:javadoc – Generate documentation cobertura:cobertura – Informs of the code coverage University , checkstyle:checkstyle – Check the codification style Science Computer of of School Software architecture Gradle • Designed specifically for projects based on Java. • Based on Groovy instead of XML • To build multi-projects. of Oviedo of University , Science Computer of of School Software architecture Gradle • Two basic concepts ▫ Project: Something that we build (for example jar files) or what we do (deploy our application) ▫ Task: Atomic unit that is donde during the of Oviedo of building (for example compile our project or launch tests) University , Science Computer of of School Software architecture Gradle • Tasks: ▫ Scripts are saved in build.gradle. ▫ Next example defines a task named “hello” that is used to print “ASW” of Oviedo of task hello { doLast { println ‘ASW’ University , } } Science ▫ Execution: Computer of of C:\> gradle –q hello School Software architecture Gradle • Add dependencies to the tasks: A task can be only executed when the taks that it depends on finish task taskY << { task taskX << { println 'taskY’ } of Oviedo of println 'taskX’ } task taskX << { task taskY(dependsOn: 'taskX') << { println 'taskX' } println "taskY" } taskY.dependsOn taskX University , Science • Execution result: taskX Computer taskY of of School Software architecture Gradle • dependencies: Similar to Maven the libraries are downloaded from a repository (it can even be a Maven repository) of Oviedo of apply plugin: 'java' repositories { University , mavenCentral() } Science dependencies { compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final' Computer testCompile group: 'junit', name: 'junit', version: '4.+' of of } School Software architecture Gradle • Dependency configuration ▫ Compile: The dependencies required to compile the source code of the project. ▫ Runtime: Dependencies required by the of Oviedo of producction classes during runtime. ▫ Test Compile: Dependencies used to compile the University , test classes. Science ▫ Test Runtime: Dependencies required to execute Computer the tests. of of School Software architecture Gradle • External dependencies: Dependencies where some of their files are build outside of the current build. They are stored in an external repository like Maven central: of Oviedo of dependencies { compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final' University , } Science Computer of of School Software architecture Gradle • Repositories: When external dependencies are added Gradle searches them in a repository repositories { mavenCentral() of Oviedo of } University , Science Computer of of School Software architecture Gradle - plugins • Plugin: Set of tasks ▫ Extend the basic model of Gradle ▫ Config the Project ▫ Apply specific configurations • 2 types of Oviedo of ▫ Scripts: Can be applied locally or remotely apply from: 'other.gradle' University , ▫ Binaries: Identified by a plugin id Science plugins { plugins { Computer id 'java' id "com.jfrog.bintray" of of apply plugin: JavaPlugin } version "0.4.1" School } Software architecture npm Node.js Package Manager Initially created by Isaac Schlueter Later became Npm inc. 3 things: 1. Website (https://www.npmjs.com/) User and organization management of Oviedo of 2. Software registry University , Public/private packages Science 3. CLI application Computer Dependency and task management of of Configuration file: package.json School Software architecture npm configuration: package.json • Configuration file: package.json ▫ npm init creates a simple skeleton • Fields: { "name": "...mandatory...", "version": "...mandatory...", "description": "...optional...", "keywords": "...", "repository": {... }, "author": "...", "license": "...", of Oviedo of "bugs": {...}, "homepage": "http://. .", University , "main": "index.js", "devDependencies": { ... }, Science "dependencies": { ... } "scripts": { "test": " ... " }, "bin": {...}, Computer of of } School Note: Yeoman provides fully featured scaffolding Software architecture npm packages Registry: http://npmjs.org Installing packages: Store the dependency in the package.json 2 options: Local Only for development npm install <packageName> --save (--save-dev) of Oviedo of Downloads <packageName> contents to node_modules folder University Global , npm install -g <packageName> Science Computer of of School Software architecture npm dependencies Dependency management Local packages are cached at node_modules folder Access to modules through: require('...') Global packages (installed with --global option) Scoped packages marked by @ of Oviedo of University , Science Computer of of School Software architecture npm commands and scripts Npm contains lots of commands start node server.js test node server.js ls lists installed packages ... of Oviedo of Custom scripts: run <name> University , More complex tasks in NodeJs Science

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    44 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us