Переглянути джерело

[TravisCI] commit api xml to api.haxe.org repo

Andy Li 7 роки тому
батько
коміт
f2533832dd
7 змінених файлів з 106 додано та 58 видалено
  1. 1 0
      .gitignore
  2. 0 2
      .travis.yml
  3. 1 1
      CONTRIBUTING.md
  4. 5 27
      Makefile
  5. 20 9
      extra/ImportAll.hx
  6. 60 0
      extra/doc.hxml
  7. 19 19
      tests/runci/Deployment.hx

+ 1 - 0
.gitignore

@@ -19,6 +19,7 @@
 /extra/deploy_key
 /extra/*_sec.gpg
 /extra/*_ssh
+/extra/doc/
 
 /src/version.ml
 /haxe

+ 0 - 2
.travis.yml

@@ -162,8 +162,6 @@ matrix:
         - DEPLOY_NIGHTLIES=1
         # haxeci_decrypt (Deploy source package to ppa:haxe/snapshots.)
         - secure: "Mw3p6bDZuqVQ6u7GrwLQfje5hhIOA4+mdqqLXYHP79UKdhgqb91Dn6IbG9vQ1VXVe64W4YZbQAMBMMRX5kEPDl6JvTVGSBhg00Mi69oO5qrCMcBI6f9FntG72YaVvLf+PA7co+vKrnJzaP2M9pe4SH9Ztbhy0YNxULp7NQ8FLsM="
-        # deploy_key_decrypt (Deploy doc to api.haxe.org.)
-        - secure: "A75uYqU0Xz6plIgSewEs0QQWe472dCMb9kf3j7Hx0DS7dApXgx8++189sw9Sv0wam5KPtbcIM292MucjGCb5zocVj9xCUVgajhEA0QpTuDMBjk/cg3ClWCGjfybaCl2E5LLdUs7Zy4b4oNWtVikOWLWJ4sC1kaarR9p6kv8yYZg="
       addons:
         ssh_known_hosts:
           - haxe.org

+ 1 - 1
CONTRIBUTING.md

@@ -12,7 +12,7 @@ This repository is about the Haxe compiler itself and the Haxe standard library.
 * The haxelib command line tool or lib.haxe.org: <https://github.com/HaxeFoundation/haxelib/issues>
 * Something on try.haxe.org: <https://github.com/clemos/try-haxe/issues>
 * Something under haxe.org/manual: <https://github.com/HaxeFoundation/HaxeManual/issues>
-* Something on api.haxe.org: For content this is probably the right repository. If it's about the representation, try <https://github.com/dpeek/dox/issues> instead.
+* Something on api.haxe.org: For content this is probably the right repository. If it's about the representation, try <https://github.com/HaxeFoundation/dox/issues> instead.
 * Something else on haxe.org: <https://github.com/HaxeFoundation/haxe.org/issues>
 
 ## Other remarks:

+ 5 - 27
Makefile

@@ -232,37 +232,15 @@ package_unix:
 
 package_bin: package_$(PLATFORM)
 
-install_dox:
-	haxelib git hxparse https://github.com/Simn/hxparse master src
-	haxelib git hxtemplo https://github.com/Simn/hxtemplo
-	haxelib git hxargs https://github.com/Simn/hxargs
-	haxelib git markdown https://github.com/dpeek/haxe-markdown master src
-	haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp
-	haxelib git hxjava https://github.com/HaxeFoundation/hxjava
-	haxelib git hxcs https://github.com/HaxeFoundation/hxcs
-	haxelib git dox https://github.com/HaxeFoundation/dox
-
-package_doc:
-	mkdir -p $(PACKAGE_OUT_DIR)
-	$(eval OUTFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_doc.zip)
-	$(eval VERSION := $(shell haxe -version 2>&1))
-	cd $$(haxelib path dox | head -n 1) && \
-		haxe run.hxml && \
-		haxe gen.hxml && \
-		haxe -lib hxtemplo -lib hxparse -lib hxargs -lib markdown \
-		-cp src -dce no --run dox.Dox -theme haxe_api -D website "http://haxe.org/" \
-		--title "Haxe API" -o $(OUTFILE) \
-		-D version "$(VERSION)" -i bin/xml -ex microsoft -ex javax -ex cs.internal \
-		-D source-path https://github.com/HaxeFoundation/haxe/blob/$(BRANCH)/std/
-
-deploy_doc:
-	scp $(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_doc.zip [email protected]:/data/haxeapi/www/v/dev/api-latest.zip
-	ssh [email protected] "cd /data/haxeapi/www/v/dev && find . ! -name 'api-latest.zip' -maxdepth 1 -mindepth 1 -exec rm -rf {} + && unzip -q -o api-latest.zip"
+xmldoc:
+	haxelib path hxcpp  || haxelib git hxcpp  https://github.com/HaxeFoundation/hxcpp
+	haxelib path hxjava || haxelib git hxjava https://github.com/HaxeFoundation/hxjava
+	haxelib path hxcs   || haxelib git hxcs   https://github.com/HaxeFoundation/hxcs
+	cd extra && haxe doc.hxml
 
 # Installer
 
 package_installer_mac:
-	$(eval DOCFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_doc.zip)
 	$(eval OUTFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_installer.tar.gz)
 	$(eval PACKFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_bin.tar.gz)
 	$(eval VERSION := $(shell haxe -version 2>&1))

+ 20 - 9
extra/ImportAll.hx

@@ -1,5 +1,5 @@
 /*
- * Copyright (C)2005-2016 Haxe Foundation
+ * Copyright (C)2005-2017 Haxe Foundation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -23,11 +23,20 @@ import haxe.macro.Context;
 
 class ImportAll {
 
+	static function isSysTarget() {
+		return Context.defined("neko") || Context.defined("php") || Context.defined("cpp") ||
+		       Context.defined("java") || Context.defined("python") ||
+		       Context.defined("lua") || Context.defined("hl") || Context.defined("eval"); // TODO: have to add cs here, SPOD gets in the way at the moment
+	}
+
 	public static function run( ?pack ) {
 		if( pack == null ) {
 			pack = "";
 			haxe.macro.Compiler.define("doc_gen");
 		}
+		if (Context.defined("interp")) {
+			haxe.macro.Compiler.define("macro");
+		}
 		switch( pack ) {
 		case "php":
 			if( !Context.defined("php") ) return;
@@ -39,8 +48,10 @@ class ImportAll {
 			if( !Context.defined("cpp") ) return;
 		case "flash":
 			if( !Context.defined("flash9") ) return;
+		case "mt","mtwin":
+			return;
 		case "sys":
-			if( !Context.defined("neko") && !Context.defined("php") && !Context.defined("cpp") ) return;
+			if(!isSysTarget()) return;
 		case "java":
 			if( !Context.defined("java") ) return;
 		case "cs":
@@ -53,10 +64,9 @@ class ImportAll {
 			if( !Context.defined("lua") ) return;
 		case "eval":
 			if( !Context.defined("eval") ) return;
-		case "tools":
-			return;
-		case "build-tool":
-			return;
+		case "ssl":
+			if (!Context.defined("neko") && !Context.defined("cpp")) return;
+		case "tools", "build-tool": return;
 		}
 		for( p in Context.getClassPath() ) {
 			if( p == "/" )
@@ -78,12 +88,13 @@ class ImportAll {
 					switch( cl ) {
 					case "ImportAll", "neko.db.MacroManager": continue;
 					case "haxe.TimerQueue": if( Context.defined("neko") || Context.defined("php") || Context.defined("cpp") ) continue;
-					case "Sys": if( !(Context.defined("neko") || Context.defined("php") || Context.defined("cpp")) ) continue;
+					case "Sys": if(!isSysTarget()) continue;
 					case "haxe.web.Request": if( !(Context.defined("neko") || Context.defined("php") || Context.defined("js")) ) continue;
-					case "haxe.macro.ExampleJSGenerator","haxe.macro.Context", "haxe.macro.Compiler": if( !Context.defined("neko") ) continue;
+					case "haxe.macro.ExampleJSGenerator","haxe.macro.Context", "haxe.macro.Compiler": if( !Context.defined("eval") ) continue;
 					case "haxe.remoting.SocketWrapper": if( !Context.defined("flash") ) continue;
 					case "haxe.remoting.SyncSocketConnection": if( !(Context.defined("neko") || Context.defined("php") || Context.defined("cpp")) ) continue;
-					case "sys.db.Sqlite" | "sys.db.Mysql" | "cs.db.AdoNet": continue;
+					case "neko.vm.Ui" | "sys.db.Sqlite" | "sys.db.Mysql" if ( Context.defined("interp") ): continue;
+					case "sys.db.Sqlite" | "sys.db.Mysql" | "cs.db.AdoNet" if ( Context.defined("cs") ): continue;
 					}
 					Context.getModule(cl);
 				} else if( sys.FileSystem.isDirectory(p + "/" + file) )

+ 60 - 0
extra/doc.hxml

@@ -0,0 +1,60 @@
+--no-output
+--macro ImportAll.run()
+-dce no
+-D doc-gen
+
+--each
+
+-neko all.n
+-xml doc/neko.xml
+
+--next
+
+-js all.js
+-xml doc/js.xml
+
+--next
+
+-swf all9.swf
+-xml doc/flash.xml
+-swf-version 11.4
+
+--next
+
+-php all_php
+-xml doc/php.xml
+
+--next
+
+-cpp all_cpp
+-xml doc/cpp.xml
+-D xmldoc
+-D HXCPP_MULTI_THREADED
+
+--next
+-java all_java
+-xml doc/java.xml
+-D xmldoc
+
+--next
+-cs all_cs
+-D unsafe
+-xml doc/cs.xml
+-D xmldoc
+
+--next
+-python all_py
+-xml doc/python.xml
+-D xmldoc
+
+--next
+--interp
+-xml doc/macro.xml
+
+--next
+-lua all_lua
+-xml doc/lua.xml
+
+--next
+-hl all_hl
+-xml doc/hl.xml

+ 19 - 19
tests/runci/Deployment.hx

@@ -4,8 +4,8 @@ import runci.Config.*;
 import runci.System.*;
 import sys.io.File;
 import sys.FileSystem;
-
-import haxe.Template;
+import haxe.*;
+import haxe.io.*;
 using StringTools;
 
 class Deployment {
@@ -90,8 +90,7 @@ class Deployment {
 
 	static function isDeployApiDocsRequired () {
 		return gitInfo.branch == "development" &&
-			Sys.getEnv("DEPLOY_API_DOCS") != null &&
-			Sys.getEnv("deploy_key_decrypt") != null;
+			Sys.getEnv("DEPLOY_API_DOCS") != null;
 	}
 
 	/**
@@ -99,12 +98,19 @@ class Deployment {
 	*/
 
 	static function deployApiDoc():Void {
-		// setup deploy_key
-		runCommand("openssl aes-256-cbc -k \"$deploy_key_decrypt\" -in extra/deploy_key.enc -out extra/deploy_key -d");
-		runCommand("chmod 600 extra/deploy_key");
-		runCommand("ssh-add extra/deploy_key");
-
-		runCommand("make", ["-s", "deploy_doc"]);
+		changeDirectory(repoDir);
+		File.saveContent("extra/doc/info.json", Json.stringify({
+			"commit": gitInfo.commit,
+			"branch": gitInfo.branch,
+		}));
+		switch (Sys.getEnv("GHP_REMOTE")) { // should be in the form of https://[email protected]/account/repo.git
+			case null:
+				infoMsg('Missing GHP_REMOTE, skip api doc deploy.');
+			case remoteRepo:
+				var localRepo = "extra/api.haxe.org";
+				runCommand("git", ["clone", remoteRepo, localRepo]);
+				runCommand("haxe", ["--cwd", localRepo, "--run", "ImportXml", FileSystem.absolutePath("extra/doc")]);
+		}
 	}
 
 	/**
@@ -304,16 +310,15 @@ class Deployment {
 
 	static public function deploy():Void {
 		var doDocs = isDeployApiDocsRequired();
-		var doNightlies = isDeployNightlies(),
-				doInstaller = doNightlies && shouldDeployInstaller();
+		var doNightlies = isDeployNightlies();
+		var doInstaller = doNightlies && shouldDeployInstaller();
 
 		if (doDocs || doNightlies) {
 			changeDirectory(repoDir);
 			if (doDocs) {
 				if (systemName != 'Windows') {
 					// generate doc
-					runCommand("make", ["-s", "install_dox"]);
-					runCommand("make", ["-s", "package_doc"]);
+					runCommand("make", ["xmldoc"]);
 					// deployBintray();
 					deployApiDoc();
 					// disable deployment to ppa:haxe/snapshots for now
@@ -322,11 +327,6 @@ class Deployment {
 				}
 			}
 			if (doNightlies) {
-				if (doInstaller && !doDocs && systemName != 'Windows') {
-					// generate doc
-					runCommand("make", ["-s", "install_dox"]);
-					runCommand("make", ["-s", "package_doc"]);
-				}
 				deployNightlies(doInstaller);
 			}
 		}