Skip to content

Merge Release into Master #4111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/services/android-plugin-build-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as path from "path";
import { MANIFEST_FILE_NAME, INCLUDE_GRADLE_NAME, ASSETS_DIR, RESOURCES_DIR, TNS_ANDROID_RUNTIME_NAME, AndroidBuildDefaults, PLUGIN_BUILD_DATA_FILENAME } from "../constants";
import { getShortPluginName, hook } from "../common/helpers";
import { Builder, parseString } from "xml2js";
import { ILogger } from "log4js";

export class AndroidPluginBuildService implements IAndroidPluginBuildService {
/**
Expand Down Expand Up @@ -428,8 +427,12 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
`-PbuildToolsVersion=${pluginBuildSettings.androidToolsInfo.buildToolsVersion}`
];

if (this.$logger.getLevel() === "INFO") {
localArgs.push("--quiet");
}

try {
await this.$childProcess.spawnFromEvent(gradlew, localArgs, "close", { cwd: pluginBuildSettings.pluginDir });
await this.$childProcess.spawnFromEvent(gradlew, localArgs, "close", { cwd: pluginBuildSettings.pluginDir, stdio: "inherit" });
} catch (err) {
this.$errors.failWithoutHelp(`Failed to build plugin ${pluginBuildSettings.pluginName} : \n${err}`);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/services/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ProjectService implements IProjectService {
private $staticConfig: IStaticConfig,
private $npmInstallationManager: INpmInstallationManager) { }

public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }) : Promise<string> {
public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }): Promise<string> {
let projectName = opts.projectName;
if (!projectName) {
this.$errors.fail("You must specify <App name> when creating a new project.");
Expand Down Expand Up @@ -133,7 +133,8 @@ export class ProjectService implements IProjectService {
shelljs.cp('-R', path.join(templateData.templatePath, "*"), destinationDirectory);
break;
case constants.TemplateVersions.v2:
await this.$pacoteService.extractPackage(templateData.templateName, projectDir);
const fullTemplateName = templateData.version ? `${templateData.templateName}@${templateData.version}` : templateData.templateName;
await this.$pacoteService.extractPackage(fullTemplateName, projectDir);
break;
default:
this.$errors.failWithoutHelp(format(constants.ProjectTemplateErrors.InvalidTemplateVersionStringFormat, templateData.templateName, templateData.templateVersion));
Expand Down
42 changes: 42 additions & 0 deletions vendor/gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import groovy.json.JsonSlurper

buildscript {
repositories {
Expand Down Expand Up @@ -32,6 +33,8 @@ def computeBuildToolsVersion = { ->
}

android {
applyBeforePluginGradleConfiguration()

compileSdkVersion computeCompileSdkVersion()
buildToolsVersion computeBuildToolsVersion()

Expand All @@ -50,3 +53,42 @@ dependencies {
compileOnly "com.android.support:support-v4:$supportVer"
compileOnly "com.android.support:appcompat-v7:$supportVer"
}

def getAppResourcesPath() {
def relativePathToApp = "app"
def relativePathToAppResources
def absolutePathToAppResources
def projectRoot = "$rootDir/../../.."
def nsConfigFile = file("$projectRoot/nsconfig.json")
def nsConfig

if (nsConfigFile.exists()) {
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
}

if(nsConfig != null && nsConfig.appPath != null){
relativePathToApp = nsConfig.appPath
}

if(nsConfig != null && nsConfig.appResourcesPath != null ) {
relativePathToAppResources = nsConfig.appResourcesPath
} else {
relativePathToAppResources = "$relativePathToApp/App_Resources"
}

absolutePathToAppResources = java.nio.file.Paths.get(projectRoot).resolve(relativePathToAppResources).toAbsolutePath()

project.ext.appResourcesPath = absolutePathToAppResources

return absolutePathToAppResources
}

def applyBeforePluginGradleConfiguration() {
def appResourcesPath = getAppResourcesPath()
def pathToBeforePluginGradle = "$appResourcesPath/Android/before-plugins.gradle"
def beforePluginGradle = file(pathToBeforePluginGradle)
if (beforePluginGradle.exists()) {
println "\t + applying user-defined configuration from ${beforePluginGradle}"
apply from: pathToBeforePluginGradle
}
}