Skip to content
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

refactor: remove Windows SDK/platform #11413

Merged
merged 9 commits into from
Jan 8, 2020
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/report-a-bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CLI version:

**Logs**:
Creating a trace-log:
- CLI: `appc run - p [ios|android|windows] -l trace`
- CLI: `appc run - p [ios|android] -l trace`
- Studio / Atom: `Log-Level (Bottom right): Trace`

(Attach by dragging into this issue)
51 changes: 6 additions & 45 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ def isMainlineBranch = (env.BRANCH_NAME ==~ MAINLINE_BRANCH_REGEXP)
def isGreenKeeper = env.BRANCH_NAME.startsWith('greenkeeper/') || 'greenkeeper[bot]'.equals(env.CHANGE_AUTHOR) // greenkeeper needs special handling to avoid using npm ci, and to use greenkeeper-lockfile

// These values could be changed manually on PRs/branches, but be careful we don't merge the changes in. We want this to be the default behavior for now!
// target branch of windows SDK to use and test suite to test with
// target branch of test suite to test with
def targetBranch = isGreenKeeper ? 'master' : (isPR ? env.CHANGE_TARGET : (env.BRANCH_NAME ?: 'master'))
def includeWindows = isMainlineBranch // Include Windows SDK if on a mainline branch, by default
// Note that the `includeWindows` flag also currently toggles whether we build for all OSes/platforms, or just iOS/Android for macOS
def runDanger = isPR // run Danger.JS if it's a PR by default. (should we also run on origin branches that aren't mainline?)
def publishToS3 = isMainlineBranch // publish zips to S3 if on mainline branch, by default
def testOnDevices = isMainlineBranch // run tests on devices
Expand All @@ -28,7 +26,6 @@ def npmVersion = 'latest' // We can change this without any changes to Jenkins.
def gitCommit = ''
def basename = ''
def vtag = ''
def isFirstBuildOnBranch = false // calculated by looking at S3's branches.json, used to help bootstrap new mainline branches between Windows/main SDK

@NonCPS
def hasAPIDocChanges() {
Expand Down Expand Up @@ -281,37 +278,6 @@ timestamps {
}
}

// Skip the Windows SDK portion if a PR, we don't need it
stage('Windows') {
if (includeWindows) {
// This may be the very first build on this branch, so there's no windows build to grab yet
try {
sh 'curl -O http://builds.appcelerator.com.s3.amazonaws.com/mobile/branches.json'
if (fileExists('branches.json')) {
def branchesJSONContents = readFile('branches.json')
if (!branchesJSONContents.startsWith('<?xml')) { // May be an 'Access denied' xml file/response
def branchesJSON = jsonParse(branchesJSONContents)
isFirstBuildOnBranch = !(branchesJSON['branches'].contains(env.BRANCH_NAME))
}
}
} catch (err) {
// ignore? Not able to grab the branches.json, what should we assume? In 99.9% of the cases, it's not a new build
}

// If there's no windows build for this branch yet, use master
def windowsBranch = targetBranch
if (isFirstBuildOnBranch) {
windowsBranch = 'master'
manager.addWarningBadge("Looks like the first build on branch ${env.BRANCH_NAME}. Using 'master' branch build of Windows SDK to bootstrap.")
}
step([$class: 'CopyArtifact',
projectName: "../titanium_mobile_windows/${windowsBranch}",
selector: [$class: 'StatusBuildSelector', stable: false],
filter: 'dist/windows/'])
sh 'rm -rf windows; mv dist/windows/ windows/; rm -rf dist'
} // if(includeWindows)
} // stage

stage('Build') {
// Normal build, pull out the version
def version = sh(returnStdout: true, script: 'sed -n \'s/^ *"version": *"//p\' package.json | tr -d \'"\' | tr -d \',\'').trim()
Expand All @@ -324,27 +290,27 @@ timestamps {
basename = "dist/mobilesdk-${vtag}"
echo "BASENAME: ${basename}"

// TODO parallelize the iOS/Android/Windows portions?
// TODO parallelize the iOS/Android portions?
ansiColor('xterm') {
timeout(15) {
def buildCommand = "npm run clean -- --android-ndk ${env.ANDROID_NDK_R16B} --android-sdk ${env.ANDROID_SDK}"
if (includeWindows) {
if (isMainlineBranch) {
buildCommand += ' --all'
}
sh buildCommand
} // timeout
timeout(15) {
def buildCommand = "npm run build -- --android-ndk ${env.ANDROID_NDK_R16B} --android-sdk ${env.ANDROID_SDK}"
if (includeWindows) {
if (isMainlineBranch) {
buildCommand += ' --all'
}
sh buildCommand
recordIssues(tools: [clang(), java()])
} // timeout
timeout(15) {
def packageCommand = "npm run package -- --version-tag ${vtag}"
if (includeWindows) {
// on mainline builds, include windows sdk, build for all 3 host OSes
if (isMainlineBranch) {
// on mainline builds, build for all 3 host OSes
packageCommand += ' --all'
} else {
// On PRs, just build android and ios for macOS
Expand Down Expand Up @@ -502,11 +468,6 @@ timestamps {
pluginFailureResultConstraint: 'FAILURE',
userMetadata: []])

// Trigger titanium_mobile_windows if this is the first build on a "mainline" branch
if (isFirstBuildOnBranch) {
// Trigger build of titanium_mobile_windows in our pipeline multibranch group!
build job: "../titanium_mobile_windows/${env.BRANCH_NAME}", wait: false
}
// Now wipe the workspace. otherwise the unstashed artifacts will stick around on the node (master)
deleteDir()
} // node
Expand Down
4 changes: 2 additions & 2 deletions build/lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const TMP_DIR = path.join(DIST_DIR, 'tmp');

// platforms/OS mappings
const ALL_OSES = [ 'win32', 'linux', 'osx' ];
const ALL_PLATFORMS = [ 'ios', 'android', 'windows' ];
const ALL_PLATFORMS = [ 'ios', 'android' ];
const OS_TO_PLATFORMS = {
win32: [ 'android', 'windows' ],
win32: [ 'android' ],
osx: [ 'android', 'ios' ],
linux: [ 'android' ]
};
Expand Down
9 changes: 0 additions & 9 deletions build/lib/docs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const spawn = require('child_process').spawn; // eslint-disable-line security/detect-child-process
const fs = require('fs-extra');
const path = require('path');
const ROOT_DIR = path.join(__dirname, '../..');
const DOC_DIR = path.join(ROOT_DIR, 'apidoc');
Expand All @@ -13,20 +12,12 @@ class Documentation {
*/
constructor(outputDir) {
this.outputDir = outputDir;
this.hasWindows = fs.existsSync(path.join(ROOT_DIR, 'windows'));
}

async generateReport(format, filename) {
const cmd = process.platform === 'win32' ? 'docgen.cmd' : 'docgen';
const cmdPath = path.join(ROOT_DIR, 'node_modules', '.bin', cmd);
const args = [ '-f', format, '-o', this.outputDir + path.sep, DOC_DIR ];
if (this.hasWindows && format !== 'typescript') {
args.push([
'-a', path.join(ROOT_DIR, 'windows/doc/Titanium'),
'-a', path.join(ROOT_DIR, 'windows/doc/WindowsOnly'),
'-a', path.join(ROOT_DIR, 'windows/doc/Modules')
]);
}

console.log(`Generating ${format} report...`);
const outputFile = path.join(this.outputDir, filename);
Expand Down
2 changes: 1 addition & 1 deletion build/lib/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Packager {
/**
* @param {String} outputDir path to place the temp files and zipfile
* @param {String} targetOS 'win32', 'linux', or 'osx'
* @param {string[]} platforms The list of SDK platforms to package ('ios', 'windows', 'android')
* @param {string[]} platforms The list of SDK platforms to package ('ios', 'android')
* @param {object} options the options object passed around
* @param {string} options.sdkVersion version string to use
* @param {string} options.versionTag version tag
Expand Down
49 changes: 0 additions & 49 deletions build/lib/windows.js

This file was deleted.

22 changes: 1 addition & 21 deletions cli/lib/tasks/process-js-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,6 @@ class ProcessJsTask extends IncrementalFileTask {
});
});

// Windows hyperloop requires that a build.windows.analyzeJsFile runs before compileJsFile
// so patch the compileJsFile hook to run that hook first and then fire the compileJsFile
// TODO: remove this in 9.0.0 TIMOB-27601
if (this.platform === 'windows') {
let origCompileJsHook = compileJsFileHook;

compileJsFileHook = this.builder.cli.createHook(`build.${this.platform}.analyzeJsFile`, this.builder, (from, to, cb) => {
const r = this.fileContentsMap.get(from);
origCompileJsHook(r, from, to, cb);
});
}

this.copyResourceHook = promisify(this.builder.cli.createHook(`build.${this.platform}.copyResource`, this.builder, (from, to, done) => {
const originalContents = fs.readFileSync(from).toString();

Expand All @@ -189,15 +177,7 @@ class ProcessJsTask extends IncrementalFileTask {
contents: originalContents,
symbols: []
};
if (this.platform === 'windows') {
// We can't pass the contents through the analyzeJsFile hook so store them in a map
// which we can then pull the contents from
this.fileContentsMap.set(from, r);
compileJsFileHook(from, to, done);
} else {
compileJsFileHook(r, from, to, done);

}
compileJsFileHook(r, from, to, done);
}));
}

Expand Down
3 changes: 1 addition & 2 deletions common/Resources/ti.internal/extensions/node/fs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import assertArgumentType from './_errors';
import path from './path';

const isWindows = Ti.Platform.name === 'windows';
const isAndroid = Ti.Platform.name === 'android';

// Keep track of printing out one-time warning messages for unsupported operations/options/arguments
Expand Down Expand Up @@ -231,7 +230,7 @@ fs.accessSync = function (path, mode = fs.constants.F_OK) {
if ((mode & fs.constants.W_OK) && !fileHandle.writable) {
throw permissionDenied('access', path);
}
if (!isWindows && (mode & fs.constants.X_OK) && !fileHandle.executable && fileHandle.isFile()) {
if ((mode & fs.constants.X_OK) && !fileHandle.executable && fileHandle.isFile()) {
throw permissionDenied('access', path);
}
};
Expand Down